﻿using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Chevron.OrderDetails.Exporter.Excel;
using Chevron.OrderDetails.Models;
using Chevron.OrderDetails.Parser;
using Chevron.OrderDetails.RefCalc;

namespace test
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var categories = new TestCategoryCatalog();
            categories.LoadCatalog(@"labs.txt");

            var catalog = new TestCatalog();
            catalog.LoadCatalogFromFile(@"catalog.ala", categories);

            var physicians = new PhysiciansCatalog();
            LabOrdersList list = LabWorksImporter.ParseLabWorksOrder(@"json.txt", catalog, physicians);

            var calc = new ReferralFeeCalculator {Catalog = catalog, Categories = categories, Orders = list};
            calc.Calculate();

            List<PhysicianDto> physort = physicians.SortByName();

            ExcelWriter.ExportPhysicianSummaryReport(physicians, list, "1_summary.xls");
            ExcelWriter.ExportPhysicianDetailedReport(physicians, list, "2_detailed.xls");
            ExcelWriter.ExportPhysicianSuperDetailedReport(physicians, list, "3_superdetailed.xls");

            string fullPath = Assembly.GetAssembly(typeof(Program)).Location;
            string theDirectory = Path.GetDirectoryName(fullPath);
            string path = Path.Combine(theDirectory, "export");
            ExcelWriter.ExportPhysicianSuperDetailedReports(physicians, list, path);
        }
    }
}